From: Robert Lipe Date: Thu, 29 Dec 2016 07:15:28 +0000 (-0500) Subject: Make geojson writer not crash when there is no URL to write. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~9^2~9^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=856b18db81a433f0742dff6ba1e6cb05af2cc0ca;p=gpsbabel.git Make geojson writer not crash when there is no URL to write. --- diff --git a/geojson.cc b/geojson.cc index 5c8fdf491..085ae0fad 100644 --- a/geojson.cc +++ b/geojson.cc @@ -74,12 +74,14 @@ geojson_waypt_pr(const Waypoint* waypoint) { if (!waypoint->description.isEmpty()) { properties["description"] = waypoint->description; } - UrlLink link = waypoint->GetUrlLink(); - if (!link.url_.isEmpty()) { - properties["url"] = link.url_; - } - if (!link.url_link_text_.isEmpty()) { - properties["urlname"] = link.url_link_text_; + if (waypoint->HasUrlLink()) { + UrlLink link = waypoint->GetUrlLink(); + if (!link.url_.isEmpty()) { + properties["url"] = link.url_; + } + if (!link.url_link_text_.isEmpty()) { + properties["urlname"] = link.url_link_text_; + } } if (!properties.empty()) { object["properties"] = properties;